package com.tubi.线程池;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class demo2 {
    public static void main(String[] args) {
            /*
            * //static ExecutorService newFixedThreadPool(int nThreads)
                //创建一个指定最多线程数量的线程池
            * */
        //参数不是初始值 而是默认值
        ExecutorService executorService = Executors.newFixedThreadPool(10);
//        线程开启
        executorService.submit(()->{
            System.out.println(Thread.currentThread().getName()+"第一个");
        });

        executorService.submit(()->{
            System.out.println(Thread.currentThread().getName()+"第二个");
        });

        executorService.shutdown();
    }
}
